import { EditUserInfo, UserInfoSearch } from "@/types/user";
import { request } from "umi";
// 获取用户信息
export async function getUserInfo() {
  return request('/system/user/profile', {
    method: 'GET',
  });
}
// 查询用户列表
export async function getUserList(params?: UserInfoSearch) {
  return request('/api/user/list', {
    method: 'GET',
    params
  });
}
// 查询用户详情
export async function getUserDetailInfo(params: { userId: number | string }) {
  return request('/api/user', {
    method: 'GET',
    params
  });
}
// 修改用户信息
export async function editUserInfo(data: EditUserInfo) {
  return request('/system/user/profile', {
    method: 'PUT',
    data
  });
}
// 修改密码
export async function changeUserPwd(params: { oldPassword: string, newPassword: string }) {
  return request('/system/user/profile/updatePwd', {
    method: 'PUT',
    params
  });
}
// 查询私信列表
export async function getLetterList(params: { pageNum: number, pageSize: number }) {
  return request('/auth/letter_list/list', {
    method: 'GET',
    params
  });
}
// 进入私信详情后查询基本信息
export async function getMessageBasicInfo(params: { sendUserId: number }) {
  return request('/auth/letter/list', {
    method: 'GET',
    params
  });
}